//
//  Created by Rene Dohan on 11/14/11.
//

#import "PendingTaskController.h"
#import "DSActivityView.h"
#import "PapRequest.h"

@implementation PendingTaskController

@synthesize affiliates, directLinks, transactions;

- (void)loadData {
    PapRequest *request = [PapRequest new];
    request.action = @"waiting_tasks";
    request.listener = self;
    [request send];
    [DSBezelActivityView newActivityViewForView:self.view];
}

- (void)onRequestData:(NSDictionary *)data {
    [DSActivityView removeView];
    NSLog(data.description);
    [self affiliates].text = (NSString *) [data valueForKey:@"pending_affiliates"];
    [self directLinks].text = [NSString stringWithFormat:@"%@", [data valueForKey:@"pending_links"]];
    [self transactions].text = [NSString stringWithFormat:@"%@", [data valueForKey:@"pending_commisions"]];
}

- (void)onRequestFailed {
    [DSActivityView removeView];
}

- (IBAction)onReloadClick:(UIButton *)sender {
    [self loadData];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadData];
}

@end